/**
 * 教师模块路由文件
 */

const Router = require('koa-router');
const router = new Router();
const { validAdd, validRoles, validLoginUser, validUpate, validSearchAvailableTeacher, validManageUpdatePassword, validUpdateMyPassword, validChangeStatus, validSearchTeacher, validSearchStatus } = require('../validators/teachers');
const { validate } = require('../validators/common');
const { add, addRoles, login, update, updatePassword, updateMyPassword, changeStatus, searchList, searchAvailableList, searchTeacherStatus } = require('../services/teachers');

router.prefix('/teachers');

router.post('/add', validate(validAdd), add);

router.post('/addRoles', validate(validRoles), addRoles);

router.post('/login', validate(validLoginUser), login);

router.put('/update', validate(validUpate), update);

router.put('/updatePassword', validate(validManageUpdatePassword), updatePassword);

router.put('/updateMyPassword', validate(validUpdateMyPassword), updateMyPassword);

router.put('/updateStatus', validate(validChangeStatus), changeStatus);

router.get('/search', validate(validSearchTeacher), searchList);

router.get('/searchAvailable', validate(validSearchAvailableTeacher), searchAvailableList);

router.get('/searchStatus', validate(validSearchStatus), searchTeacherStatus);

module.exports = router;